package com.powernode.reggie.common;

/**
 * @description: 基于 ThreadLocal 封装的工具类;用来保存和获取登录用户id
 * @author: www
 * @time: 2023/3/8 15:20
 */
public class BaseContext {
    private static ThreadLocal<Long>  threadLocal = new ThreadLocal<>();

    //用来保存登录用户的id
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }

    //获取当前用户的id
    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
